//自定义ajax封装
	function ajax(params) {
		var xmlhttp;
		//判断XMLHttpRequest是否存在
		if (window.XMLHttpRequest) {
			xmlhttp = new XMLHttpRequest();
		} else {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}

		//readystate监听事件
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4) {

				//输出响应的结果
				if (params.callback) {
					params.callback(xmlhttp);

				}
			}
		};

		//取出method参数
		var method = params.method ? params.method : "GET";
		var asynch = params.asynch ? true : params.asynch;

		//打开一个连接
		xmlhttp.open(method, params.url, params.asynch);

		//判断是否POST请求
		if (method.toLowerCase() == 'post') {
			//post请求一定要设置这句话
			xmlhttp.setRequestHeader("Content-Type",
					"application/x-www-form-urlencoded");
		}

		//判断请求是否有参数
		if (params.params) {

			//params.params = {"userName":"张三"，"gender":"男"};
			//转换成userName=张三&gengder=男
			var p = [];
			for (key in params.params) {
				p.push(key + "=" + params.params[key]);

			}
			xmlhttp.send(p.join("&"));
		} else {
			xmlhttp.send(null);
		}
	}